#define _CRT_SECURE_NO_WARNINGS 1
struct HashTable {
    struct ListNode* key;
    UT_hash_handle hh;
};

struct ListNode* getIntersectionNode(struct ListNode* headA, struct ListNode* headB) {
    struct HashTable* hashTable = NULL;
    struct ListNode* temp = headA;
    while (temp != NULL) {
        struct HashTable* tmp;
        HASH_FIND(hh, hashTable, &temp, sizeof(struct HashTable*), tmp);
        if (tmp == NULL) {
            tmp = malloc(sizeof(struct HashTable));
            tmp->key = temp;
            HASH_ADD(hh, hashTable, key, sizeof(struct HashTable*), tmp);
        }
        temp = temp->next;
    }
    temp = headB;
    while (temp != NULL) {
        struct HashTable* tmp;
        HASH_FIND(hh, hashTable, &temp, sizeof(struct HashTable*), tmp);
        if (tmp != NULL) {
            return temp;
        }
        temp = temp->next;
    }
    return NULL;
}
